]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ModalDialog: add 'default' pseudo-class to default button
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 19 Jul 2012 13:32:59 +0000 (15:32 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 21 Jul 2012 13:40:28 +0000 (15:40 +0200)
Add 'default' parameter to setButtons, that controls the binding
of Return (unless overridden) and applies the 'default' pseudo-class.
Currently it has no effect, but it will start having after the
login dialog redesign.

https://bugzilla.gnome.org/show_bug.cgi?id=619955

js/gdm/loginDialog.js
js/ui/extensionDownloader.js
js/ui/keyringPrompt.js
js/ui/modalDialog.js
js/ui/networkAgent.js
js/ui/polkitAuthenticationAgent.js
js/ui/shellMountOperation.js

index 7fb8aeefdecae4c418e34a979ec12d7b6be3f277..33307dd8ab024bc9a89af3a95d475b522ba6b882 100644 (file)
@@ -998,7 +998,8 @@ const LoginDialog = new Lang.Class({
                        { action: Lang.bind(this, function() {
                                      hold.release();
                                  }),
-                         label: C_("button", "Sign In") }];
+                         label: C_("button", "Sign In"),
+                         default: true }];
 
         this._promptEntryActivateCallbackId = this._promptEntry.clutter_text.connect('activate',
                                                                                      Lang.bind(this, function() {
index 83f8a36fc303c433b0e8dc30462e6a4ea04016ab..72e1177e805d9a7e84a6df917df976a19c65190a 100644 (file)
@@ -197,7 +197,8 @@ const InstallExtensionDialog = new Lang.Class({
                            key:    Clutter.Escape
                          },
                          { label:  _("Install"),
-                           action: Lang.bind(this, this._onInstallButtonPressed)
+                           action: Lang.bind(this, this._onInstallButtonPressed),
+                           default: true
                          }]);
 
         let message = _("Download and install '%s' from extensions.gnome.org?").format(info.name);
index 91163263ce17a0157907b8fa8c0acb211d66c7c3..da26d2a825a5602d7dba98ecc3f525de9dbacda4 100644 (file)
@@ -65,7 +65,8 @@ const KeyringDialog = new Lang.Class({
                          key:    Clutter.Escape
                        },
                        { label: '',
-                         action: Lang.bind(this, this._onContinueButton)
+                         action: Lang.bind(this, this._onContinueButton),
+                         default: true
                        }]
 
         this.setButtons(buttons);
index e30b7059684b55d689a2b3543f246d722dace90d..bdeee7352312323d31089d310410f4e0e655d753 100644 (file)
@@ -119,11 +119,17 @@ const ModalDialog = new Lang.Class({
             let label = buttonInfo['label'];
             let action = buttonInfo['action'];
             let key = buttonInfo['key'];
+            let isDefault = buttonInfo['default'];
+
+            if (isDefault && !key)
+                key = Clutter.KEY_Return;
 
             buttonInfo.button = new St.Button({ style_class: 'modal-dialog-button',
                                                 reactive:    true,
                                                 can_focus:   true,
                                                 label:       label });
+            if (isDefault)
+                buttonInfo.button.add_style_pseudo_class('default');
 
             let x_alignment;
             if (buttons.length == 1)
index 0615a908bb867a3f62b58f8afb7e3e0dd6f261d4..8435a0950b7c8c053b8d52a9ce5ebfe4064933fd 100644 (file)
@@ -147,7 +147,7 @@ const NetworkSecretDialog = new Lang.Class({
 
         this._okButton = { label:  _("Connect"),
                            action: Lang.bind(this, this._onOk),
-                           key:    Clutter.KEY_Return,
+                           default: true
                          };
 
         this.setButtons([{ label: _("Cancel"),
index 152c11f6d6fd556c395575c6429afdc501156da1..982b0f8c7569b2a3ccd68ba2d032eebabec51919 100644 (file)
@@ -178,7 +178,8 @@ const AuthenticationDialog = new Lang.Class({
                            key:    Clutter.Escape
                          },
                          { label:  _("Authenticate"),
-                           action: Lang.bind(this, this._onAuthenticateButtonPressed)
+                           action: Lang.bind(this, this._onAuthenticateButtonPressed),
+                           default: true
                          }]);
 
         this._doneEmitted = false;
index f524a132284f584b5c77b7d3789cc51cf9b9e9cc..a8f70647891421a623c40763ea53f9fa74e58bba 100644 (file)
@@ -398,7 +398,8 @@ const ShellMountPasswordDialog = new Lang.Class({
                          key:    Clutter.Escape
                        },
                        { label: _("Unlock"),
-                         action: Lang.bind(this, this._onUnlockButton)
+                         action: Lang.bind(this, this._onUnlockButton),
+                         default: true
                        }];
 
         this.setButtons(buttons);